package com.syh.jn.scm.infrastructure.repository.model.finance;

import com.syh.core.ddd.infrastructure.repository.model.SuperBusinessModel;
import lombok.*;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Table;
import java.math.BigDecimal;

/**
 * 单位应收付记录表
 */
@Data
@Builder
@NoArgsConstructor
@AllArgsConstructor
@Entity
@Table(name = "T_FINANCE_BUSINESS_ACCOUNT_RECORD")
@EqualsAndHashCode(callSuper = true)
public class BusinessAccountRecordModel extends SuperBusinessModel {
  /**
   * 客户id
   */
  @Column(name = "CUSTOMER_ID", columnDefinition = "bigint COMMENT '客户id'")
  private Long customerId;
  /**
   * 客户类型: 0上游, 1下游, 2物流
   */
  @Column(name = "CUSTOMER_TYPE", columnDefinition = "smallint COMMENT '客户类型: 0上游, 1下游, 2物流'")
  private Short customerType;
  /**
   * 数据类型: 1正规操作, 2回滚操作
   */
  @Column(name = "DATA_TYPE", columnDefinition = "smallint COMMENT '数据类型: 1正规操作, 2回滚操作'")
  private Short dataType;
  /**
   * 原始单据ID
   */
  @Column(name = "ORIGINAL_DOCUMENT_ID", columnDefinition = "bigint COMMENT '原始单据ID'")
  private Long originalDocumentId;
  /**
   * 原始单据编号
   */
  @Column(name = "ORIGINAL_DOCUMENT_CODE", columnDefinition = "varchar(50) COMMENT '编号'")
  private String originalDocumentCode;
  /**
   * 原始物流单据ID
   */
  @Column(name = "ORIGINAL_LOGISTICS_ID", columnDefinition = "bigint COMMENT '原始物流单据ID'")
  private Long originalLogisticsId;
  /**
   * 原始物流单据编号
   */
  @Column(name = "ORIGINAL_LOGISTICS_CODE", columnDefinition = "varchar(50) COMMENT '原始物流单据编号'")
  private String originalLogisticsCode;
  /**
   * 原始单据类型: 正的有(1销售单类型,2采购退货单,3收入单,4付款单),负的有(5采购单,6销售退货单,7费用单,8收款单)
   */
  @Column(name = "ORIGINAL_DOCUMENT_TYPE", columnDefinition = "smallint COMMENT '1销售单类型,2采购退货单,3收入单,4付款单,5采购单,6销售退货单,7费用单,8收款单'")
  private Short originalDocumentType;
  /**
   * 收付款金额
   */
  @Column(name = "RE_PAY_AMOUNT", columnDefinition = "decimal(19,2) COMMENT '收付款金额'")
  private BigDecimal rePayAmount;
  /**
   * 应收付金额
   */
  @Column(name = "CHANGE_AMOUNT", columnDefinition = "decimal(19,2) COMMENT '应收付金额'")
  private BigDecimal changeAmount;
  /**
   * 汇总余额
   */
  @Column(name = "SUMMARY_BALANCE", columnDefinition = "decimal(19,2) COMMENT '汇总余额'")
  private BigDecimal summaryBalance;
  /**
   * 业务记录日期
   */
  @Column(name = "RECORD_TIME_STAMP", columnDefinition = "bigint COMMENT '业务记录日期'")
  private Long recordTimeStamp;
  /**
   * 创建日期
   */
  @Column(name = "CREATE_TIME_STAMP", columnDefinition = "bigint COMMENT '创建日期'")
  private Long createTimeStamp;
}
